package org.itsolutions.javaBackup.spi.common.io;


/**
 * This is the one place, from where the buffers used should be obtained. It provides among singleton buffers also disposable 
 * buffers with ahead counted sizes.
 * @author Tomas Fecko
 */
public interface ISharedBuffer {

	// Singleton buffers can't have changeable size
	/**
	 * Method returns deque, if it exists and creates it if not.
	 * @param <T> type of items in buffer
	 * @param pBufferUID unique buffer uid
	 * @return singleton queue
	 */
	<T> IBuffer<T> getSingletonBuffer(EBufferUID pBufferUID);

	// Sizes of buffers created be these methods will change depending on the whole capacity 
	/**
	 * 
	 * @param <T> type of items in buffer
	 * @param pItemType class of items in buffer
	 * @param pMaxSize maximum size, which should be allowed for that buffer
	 * @return deque
	 */
	<T> IBuffer<T> createBuffer(Class<T> pItemType, int pMaxSize);

	/**
	 * 
	 * @param <T> type of items in buffer
	 * @param pMaxSize maximum size, which should be allowed for that buffer
	 * @return deque
	 */
	<T> IBuffer<T> createBuffer(int pMaxSize);	

	/**
	 * Method returns buffer with default size. 
	 * @param <T> type of items in buffer
	 * @param pItemType class of items in buffer
	 * @return deque
	 */
	<T> IBuffer<T> createBuffer(Class<T> pItemType);
}





